<?php

/**
 * 抢购订单列表
 * @author wyb
 */

namespace Logistics\Controller;
class OrderController extends BaseController {

//我的抢购订单列表
    public function index() {
	
		 $p = isset($_GET['p']) ? intval($_GET['p']) : '1';
       
        $keyword = isset($_GET['keyword']) ? htmlentities($_GET['keyword']) : '';
        $where = '';

      
		$where['o.supply_id'] = $this->_member_info['id'];
		
        $LogisticsOrder = M('LogisticsOrder');
        $pagesize = 10;#每页数量
        $offset = $pagesize * ($p - 1);//计算记录偏移量
        $count = $LogisticsOrder->alias('o')->where($where)->count();
	
		$list = $LogisticsOrder
		->alias('o')
		->join('LEFT JOIN zt_logistics_needs as s ON o.need_id = s.id')
		->where($where)
		->field('o.*,s.name,s.weight,s.volume,s.province_name,s.city_name,s.area_name,s.address,s.type')
		->limit($offset . ',' . $pagesize)
		->select();

        $page = new \Think\Page($count, $pagesize);
		 
        $page = $page->show();
		
		$this->assign('count', $count);
        $this->assign('list', $list);
        $this->assign('page', $page);
		
        $this->display();
    }
	

	
	
	

}
